<?php

namespace app\servercertificate\service\certificate;
use app\manage\service\ApiBase;

/**
 * @author:      李颖
 * @DateTime:    2017-07-10 15:27:15
 * @Description: 证书
 */

class Certificate extends ApiBase
{
	
	protected $certificateLogic = 'app\servercertificate\logic\Certificate';
    protected $certificateValidate = 'app\servercertificate\validate\Certificate';

    //后台获取不同状态下的证书列表
    public function adminAllCertiList(): array 
    {
        $data = $this->issetReceiveData(['keywords'=>'','uid'=>'','type'=>'','is_pick'=>'','is_transfer'=>'','status'=>' ','cate_id'=>'','no_distribute_date'=>'','page'=>1,'listRows'=>15,'token'=>' ']);
        return $this->stepRun($data, 'servercertificate/certificate/Certificate/adminAllCertiList', 'adminAllCertiList', 'adminAllCertiList');
    }

    /*管理员将证书作废*/
    public function invalid(): array 
    {
        $data = $this->receiveData(['id'=>0]);
        return $this->oneStepRun($data, 'servercertificate/certificate/Certificate/invalid', 'invalid');
    }

    /*管理员获取某一证书详情*/
    public function certificateInfo(): array 
    {
        $data = $this->issetReceiveData(['id'=>0,'token'=>' ']);
        return $this->stepRun($data, 'servercertificate/certificate/Certificate/certificateInfo', 'certificateInfo', 'certificateInfo');
    }

    /*管理员审核某一证书*/
    public function auditOneCertificate(): array 
    {
        $data = $this->issetReceiveData(['id'=>0,'status'=>' ']);
        return $this->oneStepRun($data, 'servercertificate/certificate/Certificate/auditOneCertificate', 'auditOneCertificate');
    }

    /*获取某一用户的证书列表（由状态区分）*/
    public function userCertiList(): array 
    {
        $data = $this->issetReceiveData(['user_id'=>0,'status'=>' ','page'=>1,'listRows'=>15,'idOrName'=>'','type'=>'','is_pick'=>'','is_transfer'=>'','status'=>'']);
        return $this->oneStepRun($data, 'servercertificate/certificate/Certificate/userCertiList', 'userCertiList');
    }

    /*后台管理员对某证书进行发货操作*/
    public function shipmentsGoods(): array 
    {
        $data = $this->haveIssetReceiveData(['certificate_id'=>0, 'logistics_company_code'=>'', 'logistics_company_name'=>' ', 'waybill_number'=>' ', 'token'=>' ']);
        return $this->stepRun($data, 'servercertificate/certificate/Pickupgoods/adminOnePickUpInfo,serveruser/user/User/info,serveruser/auth/App/find,serverfund/currency/currencyAccount/affirmPickUpGoods,serverfund/fund/FundAccount/affirmPickUpGoods,servercertificate/certificate/Pickupgoods/shipmentsGoods', '', 'shipmentsGoods');
    }
    /*后台获取发票申请列表*/
    public function invoiceList(): array 
    {
        $data = $this->haveIssetReceiveData(['page'=>1, 'listRows'=>15]);
        return $this->oneStepRun($data, 'servercertificate/certificate/Invoice/invoiceList', '');
    }

    /*管理员获取某证书的转让分页列表*/
    public function getTransferList(): array 
    {
        $data = $this->haveIssetReceiveData(['certificate_id'=>0, 'keywords'=>'', 'page'=>1, 'listRows'=>15]);
        return $this->oneStepRun($data, 'servercertificate/certificate/TransferLog/getTransferList', '');
    }

    /*后台管理员获取提货单列表*/
    public function pickUpGoodsList(): array 
    {
        $data = $this->haveIssetReceiveData(['keywords'=>'', 'transfer_status'=>'', 'page'=>1, 'listRows'=>15], []);
        return $this->oneStepRun($data, 'servercertificate/certificate/Pickupgoods/pickUpGoodsList', '');
    }

    /*后台管理员获取需要派发积分的证书分页列表*/
    public function getNeedDistributeList(): array 
    {
        $data = $this->haveIssetReceiveData(['page'=>1, 'listRows'=>15, 'neq_distribute_time'=>'', 'cate_id'=>0, 'keywords'=>'']);
        return $this->oneStepRun($data, 'servercertificate/certificate/Certificate/getNeedDistributeList', '');
    }
    /*今周新增证书/证书总量*/
    public function certiIncreTendency(): array 
    {
        $data = $this->haveIssetReceiveData(['dbDateFormat'=>'%y-%m-%d', 'dateFormat'=>'y-m-d', 'token'=>' ']);
        return $this->oneStepRun($data, 'servercertificate/certificate/Certificate/certiIncreTendency', '');
    }
    
    
}






